package com.unione.map.mmkv
import com.tencent.mmkv.MMKV
import com.unione.unione_protocol.robot_auto.bean.UserInfo

/**
 * APP 配置项
 */
object AppConfigManager {

    /** MMKV独有的mmapId */
    private const val MMKV_MAP_ID = "app_config"


    private val mmkv by lazy { MMKV.mmkvWithID(MMKV_MAP_ID) }

    private const val KEY_USER = "key_user"

    fun setUserInfo(userInfo: UserInfo) {
        mmkv.encode(KEY_USER, userInfo)
    }

    fun getUserInfo(): UserInfo? {
        return mmkv.decodeParcelable(KEY_USER, UserInfo::class.java, null)
    }

}